package com.whtq.front.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

/**
 * Created by
 *
 * @author wmi
 * @date 2019/12/17 - 11:30.
 * @description
 */
public class GenerateUtil {

    public static String genTransNo(){
        SimpleDateFormat formate = new SimpleDateFormat("yyMMddHHmmssSS");
        Random r = new Random();
        int a = r.nextInt(99) + 100;
        return a + formate.format(new Date());
    }


    public static String generateUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
    }


    /**
     * 10位业务编号
     * @return
     */
    public static String genFlowNo() {

        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {//有可能是负数
            hashCodeV = -hashCodeV;
        }
        return  String.format("%-10s", hashCodeV).replace(' ', '0');
    }






    public static void main(String[] args) {

        for(int i=0;i<100;i++){
            System.out.println(genTransNo());
        }
    }




}
